-- card: 3653 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 2795 -- name: NewMenu -- part 1 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=315 top=307 right=329 bottom=379 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Demo ----- HyperTalk script ----- on mouseUp push this card visual effect iris open go to card id 10546 end mouseUp -- part contents for background part 20 ----- text ----- 7 -- part contents for background part 1 ----- text ----- XFCN -- part contents for background part 22 ----- text ----- NewMenu("Title","Item 1","Item 2",...,"Item n") -- part contents for background part 13 ----- text ----- NewMenu is an XFCN (external function) that allows you to add your own menus to a HyperCard stack. You may have up to eight menus with up to 15 items per menu. The number the NewMenu function returns is a reference number to the menu you just installed. You MUST have this number to delete or make changes to the menu later on! When you change userLevels, or select paint tools, or do anything to cause HyperCard to change the menu bar--your new menu will be erased from the menu bar. It is NOT gone from memory, just from the menu bar. To have it replaced automatically do the "on idle" routine shown below. This will make sure your menu is showing whenever you are in browse mode (on idle is not called when you're in button, field, or paint tools mode). Add an item like "(-" to insert a divider line between menu options. You may also end items with a slash letter (as is "An item/I") to add command keys. All this would generally be done in a stack's script as follows: on openStack -- display new menus global menu1, menu2 -- keep the "handles" to the menus in these globals put NewMenu("Beep","Once","Twice","(-","Boing/9") into menu1 if menu1 is 0 then answer("Unable to make menu 'BEEP'") with "Drat" put NewMenu("Visual","Effect 1") into menu2 if menu2 is 0 then answer("Unable to make menu 'Visual'") with "Drat" end openStack on closeStack -- delete the menus we've created using the globals saved in openStack global menu1, menu2 put DeleteMenu(menu1) into menu1 -- clearing global for safety put DeleteMenu(menu2) into menu2 end closeStack on idle -- call ShowMenu every so often just in case our menus vanished global menu1, menu2, lastTick if (the ticks-lastTick)>120 then -- gives better performance than on every iteration put the ticks into lastTick ShowMenu(menu1) ShowMenu(menu2) end if pass idle end idle on doMenu which -- get our menu items from doMenu before HyperCard does... global menu1, menu2 -- for CheckMenu and EnableMenu below if which is "Once" then beep 1 get CheckMenu(menu1,1,true) else if which is "Twice" then beep 1 wait 4 beep 1 get CheckMenu(menu1,2,true) else if which is "Boing" then play "Boing" get CheckMenu(menu1,4,true) else if which is "Effect 1" then push card visual effect dissolve to black pop card get EnableMenu(menu2,1,false) else pass doMenu -- Remember to pass on menu commands you don't trap! end doMenu Notice that if you want the menu to appear for all cards in the stack, you would place the NewMenu function in the stack's script and install it "on openStack" and remove it "on closeStack". If you wanted a menu to appear only for a certain background, the commands would be in that background's script and done "on openBackground" and "on closeBackground". And the commands to make a menu to appear only on a certain card would be done in that card's script "on openCard"/"on closeCard".